home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / QuarkXpress.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.8 KB  |  240 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        QuarkXpress.vu
  5. #
  6. #    Contains:    Quick look test script for QuarkXPress version 3.11
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  19. #                                    launchTwitch().
  20. #     <1.0.5>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  21. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  22. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  23. #
  24. # ****************************************************************************
  25. #
  26.  
  27.  
  28.  
  29. ########################################################################
  30. #                            External libraries 
  31. #=======================================================================
  32. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  33.  
  34.  
  35. #########################################################################
  36. ########               Application Specific Tasks
  37. #########################################################################
  38.  
  39. #########################################################################
  40. #                        InitAppGlobals()
  41. #========================================================================
  42. # Author:        ML
  43. # Description:    Sets up tools and fonts for QuarkXPress.  This task
  44. #                must be called first.
  45. # Parameters:    None
  46. # Returns:        Nothing
  47. # Examples:        InitAppGlobals()
  48. #========================================================================
  49. # History:
  50. #
  51. ########################################################################
  52. task InitAppGlobals()
  53. begin
  54.     
  55.     logstr("setting up {global gApptitle}'s globals");            
  56.     global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
  57.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  58.     global kToolPaletteNum := 1; 
  59.     global kLinePaletteNum := 0;
  60.     global kPatternPaletteNum := 0;
  61.     global kColorPaletteNum := 0;
  62.  
  63.     global gLineWeights := {};# This is used for menuItems
  64.                         
  65.     global gWindowInset := {20,40,20,20};        # Window inset
  66.     global gScreenInset := {30,20,0,0};            # Screen inset
  67.     global gVoidRect := {};        # Rect not to draw in - coordinates should be RelativeToWindow
  68.     global gTextStr;
  69.     global gDocumentWindow := 0;    # only used in Freehand at this point;
  70.     
  71.     global gPaletteList :=    {
  72.                             {                        #### Start Palette #1 - Tools
  73.                             {1,14},                    # List := {Specifier for Palette window ("String" if TITLE, integer if ORD), Header height}.
  74.                             kPalWind,                # Palette type
  75.                             {1,13},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  76.                             {0,18}                    # Offset between tools {h,v}
  77.                             }                        #### End Palette #1
  78.     };
  79.     
  80.     
  81.     ### QuarkXpress                                                                    {Flag, Pattern, Line, Color}
  82.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  83.     global PageShift         :=     { 1,     1,        "PageShift",    kDrag,         0,                 {0}};
  84.     global ContentTool            :=     { 2,     1,    "ContentTool",     kMultiDrag,    0,                 {0}};
  85.     global PageRotate        :=     { 3,     1,        "PageRotate",    kDrag,         0,                 {0}};
  86.     global ZoomTool            :=     { 4,      1,        "Zoom",            kClick,        0,                 {0}};
  87.  
  88.     global TextBoxTool         :=     { 5,     1,        "TextBox",        kDrag,        0,                 {0}};
  89.     global RectTool         :=     { 6,      1,        "Rect",            kDrag,        0,                 {0}};
  90.     global RndRectTool         :=     { 7,      1,        "RndRect",        kDrag,        0,                 {0}};
  91.     global OvalTool             :=     { 8,      1,        "Oval",            kDrag,        0,                 {0}};
  92.  
  93.     global MultiPoint         :=     { 9,      1,        "MultiPoint",    kMultiClick,1,             {0}};
  94.     global StraightLine     :=     { 10,      1,        "StraightLine",    kDrag,        0,             {0}};
  95.     global LineTool         :=     { 11,      1,        "Line",            kDrag,         0,             {0}};
  96.     global LinkTool         :=     { 12,      1,        "Link",            kClick,     0,             {0}};
  97.     global UnLinkTool         :=     { 13,      1,        "UnLink",        kClick,     0,             {0}};
  98.  
  99.  
  100.  
  101.     # global Tool list
  102.     global gToolList:={    #PageShift, 
  103.                         ContentTool,
  104.                         PageRotate,
  105.                         ZoomTool,
  106.                         
  107.                         TextBoxTool,
  108.                         RectTool,
  109.                         RndRectTool,
  110.                         OvalTool,
  111.                         
  112.                         MultiPoint,
  113.                         StraightLine,
  114.                         LineTool
  115.                         #LinkTool,                    
  116.                         #UnLinkTool                    
  117.     };
  118.     
  119.             ### font characteristic lists
  120.     global gFontSizeList := {'7','9','10','12','14','18', '24','36','48','60','72'};
  121.     global gFontStyleList := {"Bold","Italic","Underline","Strikethru","Outline","Shadow"};
  122.     
  123.         ### Name of the Plain (style) menu item  ####
  124.     global gPlainStyle := "Plain";            # Plain-Style menu item
  125.  
  126.         ### How to get to the next line
  127.     global gNextLineMethod := 1;            
  128.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  129.     
  130.         ### Does moving to the next line clear all font info
  131.     global gNextLineClearsFontSettings := 0;                        
  132.  
  133.         ### Set DoWindows to skip scrolling, scroll bars not recognized
  134.     global gDoWindowList:= {1,0,1,1};
  135.  
  136. end; # InitAppGlobals
  137.  
  138. #########################################################################
  139. #                            QuarkScrapText()
  140. #========================================================================
  141. # Author:        ML
  142. # Description:    Paste text into QuarkXpress Document
  143. # Parameters:    None
  144. # Returns:        Nothing
  145. # Examples:        QuarkScrapText();
  146. # Assumptions:    None 
  147. # Applications:    QuarkXpress
  148. #========================================================================
  149. # History:
  150. #
  151. #########################################################################
  152. task QuarkScrapText()
  153. begin
  154.     global kScrapTEXT;
  155.     # Text from Scrap
  156.     logstr("Setting up for Scraptext");
  157.     Draw(global TextBoxTool); 
  158.     return(ScrapBook(kScrapTEXT));
  159. end;
  160.  
  161. #########################################################################
  162. #                            QuarkScrapPict()
  163. #========================================================================
  164. # Author:        ML
  165. # Description:    Paste pict into QuarkXpress Document
  166. # Parameters:    None
  167. # Returns:        Nothing
  168. # Examples:        QuarkScrapPict();
  169. # Assumptions:    None 
  170. # Applications:    QuarkXpress
  171. #========================================================================
  172. # History:
  173. #
  174. #########################################################################
  175. task QuarkScrapPict()
  176. begin
  177.     global kScrapPICT;
  178.     # Pict From Scrap
  179.     logstr("Setting up for ScrapPict");
  180.     Draw(global RectTool); 
  181.     ScrapBook(kScrapPict);
  182. end;
  183.  
  184. #########################################################################
  185. #                        DoTextQuarkXpress()
  186. #========================================================================
  187. # Author:        KTA
  188. # Description:    Test Text. 
  189. # Parameters:    None
  190. # Returns:        Nada
  191. # Examples:        DoTextQuarkXpress();
  192. # Assumptions:    QuarkXpress
  193. #========================================================================
  194. # History:
  195. #
  196. #########################################################################
  197. task DoTextQuarkXpress()
  198. begin
  199.     ### Vu error when selecting Font MenuItems - Can't find exposed part to select
  200.     logstr("Setting up to type text");
  201.     DrawObject({global TextBoxTool,{{106,100},{534,389}},0,0,0}); 
  202.     wait(3);
  203.     # DoText();    # Vu error when selecting Font MenuItems - Can't find exposed part to select
  204.     TypeStr(global gTextStr);
  205. end;
  206.  
  207. ################################################################################
  208. ####################             Main script                    ####################
  209. ################################################################################
  210. script QuarkXpress (ScriptLevel:= -1)
  211. begin
  212.     InitGlobals(ScriptLevel);            # initialize your general globals
  213.     InitDraw();
  214.     InitFonts();
  215.     Global gApptitle := "QuarkXpress";
  216.     global gAppVersion := '3';        # version of app you will be running
  217.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  218.     SuiteStart('QuarkXpress.vu');                    # begin a new test suite
  219.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  220.     begin
  221.         global gCustomScrapText:= task QuarkScrapText;     # define app specific task    
  222.         global gCustomScrapPict:= task QuarkScrapPict;     # define app specific task    
  223.         global gModifyDocument:= task QuarkScrapText;    # define app specific task
  224.         InitAppGlobals();                                # init app specific globals
  225.         (*
  226.         *)
  227.         DoSetUpApp(1,-1,,"OK",1,1);    # No Default window
  228.         DoDraw();
  229.         DoTextQuarkXpress();        
  230.         DoWindow();                
  231.         DoCloseApp(1);
  232.         LogStr("############################# LIMITATIONS: ############################");
  233.         LogStr("NOTE: Vu error when selecting Font MenuItems, so DoText not done.");
  234.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  235.     SuiteEnd();
  236. end; # script QuarkXpress
  237.  
  238. ### What's Needed
  239. # 2) Possibly close the toolbox before starting Window tests.
  240. # 3) Content Tool and Textbox tool could be gTextStr tools if necessary.